package top.hmtools.makedata.random;

import java.util.Random;

/**
 * 获取随机整数工具
 * @author HyboWork
 *
 */
public class RandomInteger implements IRandom<Integer> {

	@Override
	public Integer getRandom(){
		Random random = new Random();
		return random.nextInt();
	}
	
	/**
	 * 获取指定范围内的随机整数
	 * @param min
	 * @param max
	 * @return
	 */
	public Integer getRandom(int min,int max){
		if(min>max){
			return 0;
		}
		Random random = new Random();
		return random.nextInt(max-min)+min;
	}
	
	/**
	 * 获取伪随机数
	 * @param seed
	 * @return
	 */
	public Integer getRandom(int seed){
		Random random = new Random(seed);
		return random.nextInt();
	}
	
	/**
	 * 获取指定范围内且有规律的伪随机整数
	 * @param min
	 * @param max
	 * @param seed
	 * @return
	 */
	public Integer getRandom(int min,int max,int seed){
		if(min>max){
			return 0;
		}
		Random random = new Random(seed);
		return random.nextInt(max-min)+min;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
}
